<?php
namespace Admin\Controller;
use Auditing\Model\DoctorModel;
use Think\Controller;
class IndexController extends Controller {
//    public function index(){
//        echo "<a href='". U('Doctor/Index/checked') ."'>医生审批</a>";
//    }
//
    public function index(){
        $this->display();
    }
    public function top(){
        $this->display();
    }
    public function left(){
//        //取出菜单表中的菜单项
//        $menu = D('Menu');
//        //取出当前登录用户的信息
//        $adminInfo = session('ADMIN_LOGIN_SESSION');
//        if($adminInfo['username'] == 'admin'){
//            //获取1级菜单
//            $menus = $menu->order('lft')->where(['level'=>1])->select();
//            //获取2级菜单
//            $menus_2 = $menu->order('lft')->where(['level'=>2])->select();
////        var_dump($menus);exit;
//        }else{
//            //取出当前用户的权限id
//            $admin_permission = array_keys(session('PATHS'));
////            var_dump($admin_permission);exit;
//            //查询出权限对应的菜单
//            $menus = $menu->distinct(true)->field('id,name,path,parent_id')->join('__PERMISSION_MENU__ on __MENU__.id=__PERMISSION_MENU__.menu_id')->where(['permission_id'=>['in',$admin_permission]])->where(['level'=>1])->select();
//            $menus_2 = $menu->distinct(true)->field('id,name,path,parent_id')->join('__PERMISSION_MENU__ on __MENU__.id=__PERMISSION_MENU__.menu_id')->where(['permission_id'=>['in',$admin_permission]])->where(['level'=>2])->select();
////            var_dump($menus);
////            var_dump($menus_2);exit;
//        }
//        $this->assign('menus',$menus);
//        $this->assign('menus_2',$menus_2);
        //查询当前用户信息
        $user_token = session('NOW_USER_TOKEN');//获取用户信息
        $user_info = M('userdetail')->where(['token'=>$user_token])->find();
        $this->assign($user_info);

        //根据审核状态 来获取不同参数
        $doctor_model = new DoctorModel();
        $status = $doctor_model->getDoctorStatus($user_token);
        if($status == '1'){
            //审核成功
            $res = 'success';
        }else{
            $res = 'wait';
        }
        $this->assign('status',$res);
        $this->display();
    }
    public function right(){
        $this->display();
    }
}